{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "f5315e60",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-12-7dc30f895953>:15: FutureWarning: Pass sr=16000 as keyword args. From version 0.10 passing these as positional arguments will result in an error\n",
      "  y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=shift)\n",
      "<ipython-input-12-7dc30f895953>:15: FutureWarning: Pass sr=16000 as keyword args. From version 0.10 passing these as positional arguments will result in an error\n",
      "  y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=shift)\n"
     ]
    }
   ],
   "source": [
    "import librosa\n",
    "import soundfile\n",
    "\n",
    "filenames = []\n",
    "\n",
    "for i in range(21):\n",
    "    filenames.append(\"bamboozle/bamboozle-brandon-\"+ str(i+1))\n",
    "for i in range(15):\n",
    "    filenames.append(\"bamboozle/bamboozle_a_\"+ str(i+1))\n",
    "\n",
    "pitches = [-3, -2.5, -2, -1.5 -1, -0.5, 0.5, 1, 1.5, 2, 2.5, 3]\n",
    "for shift in pitches:\n",
    "    for file in filenames:\n",
    "        y, sr = librosa.load(file+\".wav\", sr=16000) # y is a numpy array of the wav file, sr = sample rate\n",
    "        y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=shift)\n",
    "        soundfile.write(file+\"_shift_\" + str(shift) + \".wav\", y_shifted, samplerate=16000)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d39f3da0",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
